package com.test.client.customTimeLine;

public class TimeLineEventImpl {
	public static native TimeLineEvent create(String id, double start, double end, double latestStart, double earliestEnd, String title,
			String description, boolean instant, String eventImage, String eventLink, String eventIcon, String eventID)/*-{
		var eventsToDisplay=new Array();
		var evt= new $wnd.Timeline.DefaultEventSource.Event({
		id:id+"",
		start:new Date(start),
		//end:new Date(end),
		//latestStart:new Date(latestStart),
		//earliestEnd:new Date(earliestEnd),
		//instant: instant,
		isDuration:false,
		text: title,
		description:description,
		//image:eventImage,
		link: eventLink,
		color:'red',
		icon:eventIcon,
		// tapeImage:eventIcon,
		//tapeRepeat:repeat,
		textColor : 'green',
		eventID: eventID
		});
		return evt;
	}-*/;

	public static native TimeLineEvent create(String id, double start, String title, String description, boolean instant,
			String eventImage, String eventIcon, String eventID)/*-{
		var eventsToDisplay=new Array();
		var evt= new $wnd.Timeline.DefaultEventSource.Event({
		id:id+"",
		start:new Date(start),
		//end:new Date(end),
		//latestStart:new Date(latestStart),
		//earliestEnd:new Date(earliestEnd),
		//instant: instant,
		isDuration:false,
		text: title,
		description:description,
		//image:eventImage,
		//link: eventLink,
		color:'red',
		icon:eventIcon,
		// tapeImage:eventIcon,
		//tapeRepeat:repeat,
		textColor : 'green',
		eventID: eventID
		});
		return evt;
	}-*/;

	public static native void selectEventOnTimeLine(double startDate, String eventId, CustomTimeLine timeLine)/*-{
		var evt = timeLine.getBand(0).getEventSource().getEvent(eventId);
		if (evt) {
		timeLine.getBand(0).scrollToCenter(evt.getStart());
		}else{
		timeLine.getBand(0).setMinVisibleDate(new Date(startDate));

		}
	}-*/;

	public static native boolean isPresent(CustomTimeLine timeLine, String eventId) /*-{
		var evt = timeLine.getBand(0).getEventSource().getEvent(eventId);
		if(evt) return true;
		return false;
	}-*/;

}
